﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace PublSystem
{
    public partial class Delete : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            int article = 0;
            try
            {
                article = int.Parse(Request.QueryString["article"]);

            }
            catch
            {
                article = 0;
            }

            if (article > 0)
            {
                try
                {
                    using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["DefaultConnection"].ToString()))
                    {
                        conn.Open();
                        SqlCommand cmdDeleteKeywordsLinks =
                        new SqlCommand("DELETE FROM PublicationsInfo.Publications WHERE publicationId=" + article, conn);
                        cmdDeleteKeywordsLinks.ExecuteScalar();

                        SuccessOrNot.Text = "Project successfully deleted!";
                    }
                }
                catch
                {
                    SuccessOrNot.Text = "Project delete failed!";
                }
            }
        }
    }
}